package com.lmj.wx_blog.controller;

import com.lmj.wx_blog.entry.User2;
import com.lmj.wx_blog.service.User2Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

/**
 * 功能描述:
 *
 * @author: 李明杰
 * @date: 2022/1/19 14:43
 */
@RestController
public class User2Controller {

    @Autowired
    User2Service user2Service;

    /**
     * 一条一条插入
     */
    @GetMapping("/user2")
    public void user2() {
        List<User2> users = new ArrayList<>();
        for (int i = 0; i < 50000; i++) {
            User2 u = new User2();
            u.setAddress("广州：" + i);
            u.setUsername("张三：" + i);
            u.setPassword("123：" + i);
            users.add(u);
        }
        user2Service.addUserOneByOne(users);

    }
}
